//
//  DiTuDaoHangViewController.m
//  qiJi
//
//  Created by 凤利史 on 2018/4/26.
//  Copyright © 2018年 sunrose. All rights reserved.
//

#import "DiTuDaoHangViewController.h"
#import <MAMapKit/MAMapKit.h>
#import <AMapFoundationKit/AMapFoundationKit.h>

@interface DiTuDaoHangViewController ()

@property (nonatomic, strong) MAMapView *mapView;
@property (nonatomic, strong) UILabel *shiJianLab;
@property (nonatomic, strong) UILabel *luCHengLab;
@end

@implementation DiTuDaoHangViewController


- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    
    [self creationView];
}

- (BOOL)prefersStatusBarHidden{
    return YES;
}

- (void)creationView{
    
    UIImageView *imgView = [[UIImageView alloc] init];
    [self.view addSubview:imgView];
    imgView.image = [UIImage imageNamed:@"map_bg"];
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.left.equalTo(self.view);
        make.right.equalTo(self.view);
        
    }];
    //时间
    UIImageView *imgViewOfTime = [[UIImageView alloc] init];
    [imgView addSubview:imgViewOfTime];
    [imgViewOfTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).with.offset(25);
        make.centerX.equalTo(self.view).with.offset(-self.view.frame.size.width/4);
        
    }];
    
    imgViewOfTime.image = [UIImage imageNamed:@"map_time_icon"];
    self.shiJianLab = [[UILabel alloc] init];
    [imgView addSubview:self.shiJianLab];
    [self.shiJianLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imgViewOfTime.mas_bottom).with.offset(15);
        make.centerX.equalTo(imgViewOfTime);
        
    }];
    self.shiJianLab.font = [UIFont fontWithName:@"DINEngschrift LT Alternate" size:13];
    self.shiJianLab.textColor = [UIColor whiteColor];
    self.shiJianLab.text = @"123123123";
    
    UILabel *labXiaoShi = [[UILabel alloc] init];
    [imgView addSubview:labXiaoShi];
    [labXiaoShi mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.shiJianLab.mas_bottom).with.offset(10);
        make.centerX.equalTo(imgViewOfTime);
        
    }];
    labXiaoShi.font = [UIFont fontWithName:@"DINEngschrift LT Alternate" size:12];
    labXiaoShi.textColor = [UIColor whiteColor];
    labXiaoShi.text = @"小时";
    
    
    UIImageView *luChengImgView = [[UIImageView alloc] init];
    [imgView addSubview:luChengImgView];
    [luChengImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).with.offset(25);
        make.centerX.equalTo(self.view).with.offset(  self.view.frame.size.width/4);
        
    }];
    
    luChengImgView.image = [UIImage imageNamed:@"map_distance_icon"];
    
    
    self.luCHengLab = [[UILabel alloc] init];
    [imgView addSubview:self.luCHengLab];
    [self.luCHengLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(luChengImgView.mas_bottom).with.offset(15);
        make.centerX.equalTo(luChengImgView);
        
    }];
    self.luCHengLab.font = [UIFont fontWithName:@"DINEngschrift LT Alternate" size:13];
    self.luCHengLab.textColor = [UIColor whiteColor];
    self.luCHengLab.text = @"200";
    
    UILabel *labKM = [[UILabel alloc] init];
    [imgView addSubview:labKM];
    [labKM mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.luCHengLab.mas_bottom).with.offset(10);
        make.centerX.equalTo(luChengImgView);
        
    }];
    labKM.font = [UIFont fontWithName:@"DINEngschrift LT Alternate" size:12];
    labKM.textColor = [UIColor whiteColor];
    labKM.text = @"km";
    
    
    
    
    
    
    
    
    ///地图需要v4.5.0及以上版本才必须要打开此选项（v4.5.0以下版本，需要手动配置info.plist）
    [AMapServices sharedServices].enableHTTPS = YES;
    
    ///初始化地图
    _mapView = [[MAMapView alloc] initWithFrame:CGRectMake(0, 110, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT-110)];
    
    
    
    ///如果您需要进入地图就显示定位小蓝点，则需要下面两行代码
    _mapView.showsUserLocation = YES;
    _mapView.userTrackingMode = MAUserTrackingModeFollow;
    
    ///把地图添加至view
    [self.view addSubview:_mapView];
    UIButton *backButton = [[UIButton alloc] init];
    [self.view addSubview:backButton];
    [backButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).with.offset(-45);
        make.centerX.equalTo(self.view);
        
    }];
    [backButton setBackgroundImage:[UIImage imageNamed:@"map_back_btn"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
    
    
    
}
- (void)backClick{
    
    [self.navigationController popViewControllerAnimated:YES];
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
